<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>

		<script type="text/javascript">
			//构造函数模式
			function Person(name, age, sex, boyfriend) {
				this.name = name;
				this.age = age;
				this.sex = sex;
				this.boyfriend = boyfriend;
				this.speak = function() {
					alert('明日复明日')
				};
			}
			var oPerson1 = new Person('小明', '18岁', '男', '隔壁老王')
			for(var a in oPerson1) {
				alert(oPerson1[a])
			}

			//工厂模式
			function car() {
				var car = new Object;
				car.card = '20170725'
				car.price = 1000
				car.explain = '说明书'
			}
			var car1 = car()
		</script>
	</body>

</html>